<template>
  <div class="module_container">
    <div class="module_title right"
         flex
    >
      <!-- <div class="tab" flex>
        <div>加分行为</div>
        <div class="active" style="margin-left:-20px">减分行为</div>
      </div> -->
      <div class="title_text"
           flex="cross:center"
           @click="$emit('img-click')"
      >
        <img src="@/assets/img_qingqin/module1/icon_go.png">
        亲清监测
      </div>
    </div>
    <div class="content">
      <div class="sub_title">企业迁出迁入情况</div>
      <div flex="main:justify"
           class="box_1"
      >
        <div>
          <div class="dight">{{ migrationData.myxz }}</div>
          <span>本月迁入企业</span>
        </div>
        <div>
          <div class="dight_normal">
            环比
            <img style="display: inline-block; margin-left: 15px"
                 src="@/assets/img_qingqin/module5/up.png"
            >
            <b style="font-size: 32px; color: #7dff6e">{{ parseInt(migrationData.hb) || '--' }}</b>
          </div>
          <div>
            同比
            <img style="display: inline-block; margin-left: 15px"
                 src="@/assets/img_qingqin/module5/down.png"
            >
            <b style="font-size: 32px; color: #f44336">{{ parseInt(migrationData.tb) || '--' }}</b>
          </div>
        </div>
        <img src="@/assets/img_qingqin/module5/box1_line.png">
        <div>
          <div class="dight">{{ migrationData1.myxz }}</div>
          <span>本月迁出企业</span>
        </div>
        <div>
          <div class="dight_normal">
            环比
            <img style="display: inline-block; margin-left: 15px"
                 src="@/assets/img_qingqin/module5/up.png"
            >
            <b style="font-size: 32px; color: #7dff6e">{{ parseInt(migrationData.hb) || '--' }}</b>
          </div>
          <div>
            同比
            <img style="display: inline-block; margin-left: 15px"
                 src="@/assets/img_qingqin/module5/down.png"
            >
            <b style="font-size: 32px; color: #f44336">{{ parseInt(migrationData.tb) || '--' }}</b>
          </div>
        </div>
      </div>

      <div class="sub_title">企业登记趋势</div>
      <div ref="bar" class="bar" />
      <div class="sub_title">企业税收趋势</div>
      <div ref="bar1" class="bar" />

      <!-- <img src="@/assets/img_xinyong/module2/data_circle_bg.png" alt="" srcset=""> -->
    </div>
  </div>
</template>

<script>
import { optionLine2, optionLine } from './module3_option.js'
// import Charts from '@jiaminghi/charts'
import Highcharts from '@/config/highCharts'
import { monitorTrend, migrationResult } from '@/api/home'
export default {
  data() {
    return {
      migrationData: {},
      migrationData1: {}
    }
  },
  created() {
    this.handleChartsData()
    migrationResult().then(res => {
      this.migrationData = res.data[0]
      this.migrationData1 = res.data[1]
    })
  },
  methods: {
    handleChartsData() {
      // monitorTrend().then(res => {
      //   const data = res.data.reverse()
      //   optionLine2.xAxis.categories = data.map(item => item.month.slice(-2) + '月')
      //   optionLine2.series[0].data = data.map(item => item.registeredCount)
      //   optionLine2.series[1].data = data.map(item => item.registeredCapital)
      //   this.$nextTick(() => {
      //     Highcharts.chart(this.$refs.bar, optionLine2)
      //     Highcharts.chart(this.$refs.bar1, optionLine)
      //     // new Charts(this.$refs.bar1).setOption(optionLine)
      //   })
      //   // optionLine2
      // })
      this.$nextTick(() => {
          Highcharts.chart(this.$refs.bar, optionLine2)
          Highcharts.chart(this.$refs.bar1, optionLine)
          // new Charts(this.$refs.bar1).setOption(optionLine)
        })
    }
  }
}
</script>

<style lang="scss" scoped>
.content {
  // margin-top: 20px;
  // position: relative;
  padding: 25px 40px;
  font-size: 28px;
  .sub_title {
    margin-top: 20px;
    margin-bottom: 20px;

    background: url('~@/assets/img_xinyong/module6/sub_title_bg.png') no-repeat;
    width: 402px;
    height: 58px;
    line-height: 58px;
    // padding:20px;
    padding-left: 70px;
    font-size: 28px;
  }
  & > .bar {
    width: 100%;
    height: 240px;
    margin-bottom: 15px;
  }
  .box_1 {
    color: #bfdaff;
    .dight {
      background: url('~@/assets/img_qingqin/module5/dight_bg.png') no-repeat;
      background-size: 100% 100%;
      width: 120px;
      text-shadow: 0 16px 23px rgba(255, 203, 53, 0.5);
      font-size: 52px;
      color: #fad900;
      text-align: center;
      padding: 20px;
      padding-bottom: 32px;
    }
    .dight_normal {
      height: 106px;
      line-height: 100px;
    }
  }

  .legend_box {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    position: relative;
    flex: 1;
    & > * {
      width: 48%;
      line-height: 64px;
      color: #bfdaff;
      background: url('~@/assets/img_qingqin/module2/card_bg.png') no-repeat;
      background-size: 100% 100%;
      text-align: center;
      padding: 0 10px;
      box-sizing: border-box;
      margin-bottom: 24px;
    }
  }
  & > .ranking {
    margin-bottom: 10px;
    color: #c0e6ff;
    & > *:first-child {
      width: 64px;
      height: 64px;
      text-align: center;
      line-height: 64px;
      background: url('~@/assets/img_qingqin/module2/rank_mark_normal_bg.png')
        no-repeat;
      background-size: 100% 100%;
      &.active {
        background: url('~@/assets/img_qingqin/module2/rank_mark_active_bg.png')
          no-repeat;
        background-size: 100% 100%;
      }
    }
    & > *:last-child {
      background: url('~@/assets/img_qingqin/module2/rank_data_bg.png')
        no-repeat;
      background-size: 100% 100%;
      width: 1020px;
      height: 64px;
      line-height: 64px;
      padding-left: 30px;
      &.active {
        background: url('~@/assets/img_qingqin/module2/rank_data_bg_active.png')
          no-repeat;
        background-size: 100% 100%;
      }
    }
  }
  .l_circle {
    background: url('~@/assets/img_xinyong/module2/data_circle_bg.png')
      no-repeat;
    background-size: cover;
    height: 280px;
    width: 280px;
    position: relative;
    .text {
      position: absolute;
      bottom: -50px;
      text-align: center;
      width: 100%;
    }
    // padding-bottom: 20px;
  }
  .list_box {
    color: #bfdaff;
    & > *:not(:first-child) {
      margin-top: 23px;
    }
  }
}
</style>
